#include<iostream>
#define ll long long
using namespace std;
const int  mod=1e6+7;
ll a[200];
ll f[200][1005];
int main(){
    ll n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        f[i][0]=1;
    }
    f[0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            for(int k=0;k<=a[i];k++){
                if(j-k>=0){
                    f[i][j]+=f[i-1][j-k];
                    f[i][j]%=mod;
                }
            }
        }
    }
    cout<<f[n][m];
}